package com.lixin.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppConfig {

    @Bean
    public RouteLocator getRouteLocator(RouteLocatorBuilder builder) {
        RouteLocatorBuilder.Builder routes = builder.routes();
        return routes.
                route("route_two", r -> r.path("/internet").uri("https://news.baidu.com")).
                route("route_one", r -> r.path("/guonei").uri("https://news.baidu.com")).build();
    }

}
